<!-- 统计服务 -->
<template>
  <div>
    <!-- 应用统计 -->
    <div class="data-card">
      <div class="title">应用统计</div>
      <ul class="count-list">
        <li class="count-data">
          <span class="label-tip">应用统计</span>
          <span class="label">{{ countData.appCount }}</span>
        </li>
        <li class="count-data">
          <span class="label-tip">数据库统计</span>
          <span class="label">{{ countData.databaseCount }}</span>
        </li>
      </ul>
    </div>

    <!-- 权限设置 -->
    <div class="rbac-data-card">
      <div class="title">生成统计</div>
      <ul class="count-list">
        <li class="count-data">
          <span class="label-tip">脚手架生成数</span>
          <span class="label">{{ countData.genAppCount }}</span>
        </li>
        <li class="count-data">
          <span class="label-tip">数据库生成数</span>
          <span class="label">{{ countData.genDataCount }}</span>
        </li>
      </ul>

      <div class="childAccount">
        <div>代码生成器使用说明</div>
      </div>

      <ul class="quickEntry">
        <li>
          <a
            title="应用脚手架"
            @click="bingGit()"
            class="v3-4-29-btn v3-4-29-medium v3-4-29-btn-normal"
            ><span class="v3-4-29-btn-helper">绑定仓库</span></a
          >
        </li>
        <li>
          <a
            title="我的应用"
            @click="applicationManger()"
            class="v3-4-29-btn v3-4-29-medium v3-4-29-btn-normal"
            ><span class="v3-4-29-btn-helper">应用管理</span></a
          >
        </li>
      </ul>
    </div>
  </div>
</template>

<script>

import { dashboardCount } from "@/api/Common" ; 

export default {
  components: {},
  data() {
    return {
      functionCount: 123,
      accountCount: 1200,
      countData: {
        appCount: 12 , 
        databaseCount: 10 , 
        genAppCount: 12 , 
        genDataCount: 87 , 
      }, 
    };
  },
  created() {
    this.initCount() ; 
  } ,
  methods: {
    initCount(){
      dashboardCount().then(res => {
        this.countData = res.data ;
      });
    } ,
    bingGit(){
        var toPath = '/com/alinesno/cloud/business/buildGit/list' ; 
        this.$router.push({path: toPath});
    } ,
    applyApi(){
      this.$router.push({ path: '/com/alinesno/cloud/business/buildGit/list' })
    } , 
    applicationManger(){
      this.$router.push({ path: '/com/alinesno/cloud/business/buildApplication/list' })
    }
  },
};
</script>

<style scoped lang="scss">
.data-card {
  border: 1px solid #e3e4e6;
  background: #fff;
  border-radius: 2px;
  padding: 20px;
  float: left;
  width: 100%;
  margin-bottom: 20px;

  .title {
    margin-top: 0px;
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 500;
  }

  ul.count-list {
    list-style: none;
    float: left;
    padding: 0px;
    margin: 0px;
    width: 100%;

    li.count-data {
      float: left;
      background: #f7f9fa;
      border-color: #f7f9fa;
      flex: 1;
      height: auto;
      position: relative;
      text-align: left;
      margin-right: 8px;
      padding: 12px;
      width: calc(50% - 8px);
      text-decoration: none;
      overflow: hidden;
      border-width: 1px;
      border-style: solid;
      border-radius: 2px;
      transition: all 0.1s linear;
      text-align: left;

      span.label-tip {
        width: 100%;
        float: left;
        font-size: 12px;
      }
      span.label {
        color: #333;
        display: block;
        line-height: 36px;
        font-size: 20px;
      }
    }
  }
}

.rbac-data-card {
  border: 1px solid #e3e4e6;
  background: #fff;
  border-radius: 2px;
  padding: 20px;
  float: left;
  width: 100%;
  margin-bottom: 20px;

  .title {
    margin-top: 0px;
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 500;
  }

  .childAccount {
    background: #f7f9fa;
    padding: 8px;
    color: #565050;
    word-break: break-all;
    font-size: 12px;
    margin-top: 20px;
    float: left;
    width: 100%;
    line-height: 15px;
  }

  ul.count-list {
    list-style: none;
    float: left;
    padding: 0px;
    margin: 0px;
    width: 100%;

    li.count-data {
      float: left;
      background: #f7f9fa;
      border-color: #f7f9fa;
      flex: 1;
      height: auto;
      position: relative;
      text-align: left;
      margin-right: 8px;
      padding: 12px;
      width: calc(50% - 8px);
      text-decoration: none;
      overflow: hidden;
      border-width: 1px;
      border-style: solid;
      border-radius: 2px;
      transition: all 0.1s linear;
      text-align: left;

      span.label-tip {
        width: 100%;
        float: left;
        font-size: 12px;
      }
      span.label {
        color: #333;
        display: block;
        line-height: 36px;
        font-size: 20px;
      }
    }
  }

  ul.quickEntry {
    display: flex;
    justify-content: space-between;
    padding: 0px;
    margin: 0px;
    float: left;
    width: 100%;
    font-size: 12px;
    margin-top: 20px;

    li {
      display: inline-block;
      flex-grow: 1;
      flex-basis: 0;
      flex-basis: 0;
      border: 1px solid #c0c6cc;
      text-align: center;
      margin-right: 5px;
      border-radius: 2px;
      font-size: 12px;
      font-weight: 600;
      color: #333;

      a {
        color: #333;
        cursor: pointer;
      }
    }
  }
}
</style>


